subroutine readlabel(lunit,t_array0,myrank)
  use param
  use global_param,only:n_point_type
  use data_param,only:lafn
  use data_param,only:n_label_data
  use data_param,only:label_exist
  use label_data_param,only:n_obj_type
  use label_data_param,only:obj_type
  implicit none

  interface
     function reallocObjectType(p,n)
       use derived
       type(ObjectType),pointer,dimension(:) :: &
            reallocObjectType,p
       integer,intent(in) :: n
     end function reallocObjectType
  end interface

  integer,intent(in) :: lunit,t_array0(8),myrank

  integer :: nunit,count_line,len_str,asci_code
  character(len=len_linebuf) :: eatline
  character(len=len_wordbuf),dimension(max_n_word) :: eatword
  character(len=8) :: d_time_str

  integer :: i,n

  if (.not.label_exist) call abnormal_stop("readlabel",&
       "The file for label is not specified in the input script.")

  nunit=1

  open(unit=nunit,file=lafn,status='old',err=103)
  count_line=0
  n=0
  do
     read(nunit,'(a)',end=100,err=101) eatline
     count_line=count_line+1
     len_str=len_trim(eatline)
     if (len_str.eq.0) cycle
     eatline=adjustl(eatline)
     asci_code=ichar(eatline(1:1))
     if (asci_code.eq.ccode) cycle
     read(eatline(1:len_str),*,end=102) &
          (eatword(i),i=1,max_n_word)
102  continue
     n=n+1
     n_obj_type=n
     n_label_data=n_label_data+1
     ! c1:no
     ! c2:label
     ! c3:xmol_label (deleted)
     obj_type=>reallocObjectType(obj_type,n)
     read(eatword(1),*) obj_type(n)%type_no
     obj_type(n)%name=trim(adjustl(eatword(2)))
     ! obj_type(n)%xmol_label=trim(adjustl(eatword(3)))
  end do

103 continue
  call abnormal_stop("readlabel",&
       "Error occurs while the label file opens.")

101 continue
  call abnormal_stop("readlabel",&
       "Error occurs during reading the data file.")

100 continue

  close(nunit)

  ! Print the label file info.
  call log_msg1(lunit,"")
  call log_msg1(lunit,"Message from the subourinte (readlabel)")
  call log_msg1(lunit,"")
  write(lunit,'(1x,i0,1x,"lines read from the ",a)') &
       count_line,trim(lafn)
  write(lunit,'(1x,"Number of types of objects=",1x,i0)') &
       n_obj_type

  ! Write the message to the terminal and log file
  call print_d_time(t_array0,d_time_str)
  if (myrank.eq.0) &
       write(*,'(a8,":READLABEL DONE.")') d_time_str(1:8)
  write(lunit,*)
  write(lunit,'(a8,":READLABEL DONE.")') d_time_str(1:8)

  return

end subroutine readlabel
